package org.monkey.common.generator.util;

import java.util.HashMap;
import java.util.Map;
import lombok.Data;
import org.monkey.common.generator.entity.DateType;
import org.monkey.common.generator.service.impl.MySqlTypeConvert;

@Data
public class TypeUtil {
  private static final Map<String, String> cache = new HashMap<>();

  public static String jdbcTypeToJavaType(String sqlType) {
    String s = cache.get(sqlType);
    if (s == null) {
      MySqlTypeConvert typeConvert = new MySqlTypeConvert();
      s = typeConvert.processTypeConvert(DateType.ONLY_DATE, sqlType).getType();
      cache.put(sqlType, s);
    }
    return s;
  }
}
